﻿using QldtSdh.BLL;
using System;
using System.Collections.Generic;

namespace QldtSdh.DAL.Models
{
    public partial class LopHocPhan_ThoiKhoaBieu
    {
        //public string MaLopHocPhanGUID { get; set; }
        //public string MaGiangVien { get; set; }
        //public string MaPhongHoc { get; set; }
        //public System.DateTime NgayHoc { get; set; }
        //public int BuoiHoc { get; set; }
        //public string MoTa { get; set; }
        //public virtual GiangVien GiangVien { get; set; }
        //public virtual LopHocPhan LopHocPhan { get; set; }
        //public virtual PhongHoc PhongHoc { get; set; }

        public string _Value
        {
            get
            {
                var gv = (GiangVien == null) ? "?" : GiangVien.GiangVienDescTKB;
                var ph = BizPhongHoc.GetByID(MaPhongHoc);
                return string.Format("{0}\r\n{1}\r\n{2}", gv, ph != null ? ph.TenPhongHoc : "", MoTa);
            }
        }

        public string ThuTrongTuan
        {
            get
            {
                var x = "";
                switch (NgayHoc.DayOfWeek)
                {
                    case DayOfWeek.Monday: x = "2"; break;
                    case DayOfWeek.Tuesday: x = "3"; break;
                    case DayOfWeek.Wednesday: x = "4"; break;
                    case DayOfWeek.Thursday: x = "5"; break;
                    case DayOfWeek.Friday: x = "6"; break;
                    case DayOfWeek.Saturday: x = "7"; break;
                    case DayOfWeek.Sunday: x = "CN"; break;
                }
                return x;
            }
        }

        public string BuoiString { get { return BuoiHoc == 0 ? "Sáng" : BuoiHoc == 1 ? "Chiều" : "Tối"; } }

        public DateTime NgayDauTuanCuaNgayHoc
        {
            get
            {
                var date = NgayHoc.Date;
                int x = 0;
                switch (NgayHoc.DayOfWeek)
                {
                    case DayOfWeek.Monday: x = 0; break;
                    case DayOfWeek.Tuesday: x = 1; break;
                    case DayOfWeek.Wednesday: x = 2; break;
                    case DayOfWeek.Thursday: x = 3; break;
                    case DayOfWeek.Friday: x = 4; break;
                    case DayOfWeek.Saturday: x = 5; break;
                    case DayOfWeek.Sunday: x = 6; break;
                }
                return date.Subtract(new TimeSpan(x, 0, 0, 0));
            }
        }
    }


    public class ThoiKhoaBieuForPrint
    {
        public string MaLopHocPhanGUID { get; set; }
        public string MaGiangVien { get; set; }
        public string MaPhongHoc { get; set; }
        public System.DateTime NgayHoc { get; set; }
        public int BuoiHoc { get; set; }
        public string MoTa { get; set; }
        //public virtual GiangVien GiangVien { get; set; }
        //public virtual LopHocPhan LopHocPhan { get; set; }
        //public virtual PhongHoc PhongHoc { get; set; }

        public string ThuTrongTuan { get; set; }

        public string BuoiString { get; set; }

        public string ThoiGianApDung { get; set; }
        public DateTime NgayBatDau { get; set; }
        public DateTime NgayKetThuc { get; set; }

        public string TenLopHocPhan { get; set; }

        public string STT { get; set; }

        public string MaHocPhanGUID { get; set; }
        public string SoTinChi { get; set; }
        public string SoHocVien { get; set; }

        public string ThuBuoiPhong { get { return ThuTrongTuan + "." + BuoiHoc + "." + MaPhongHoc; } }
    }

    public enum BuoiHocEnum : int { Sang, Chieu, Toi };
}
